from django.http import HttpResponse
from django.shortcuts import render
def home(request):
    return render(request, 'index.html')
def hello_django(request):
    return HttpResponse("Hello, Django!")
def add_numbers(request, a, b):
    result = a + b
    return HttpResponse(f"The sum of {a} and {b} is {result}.")
def post_view(request, id):
    return HttpResponse(f"Post ID: {id}")
from django.shortcuts import render
def home(request):
    return render(request, 'index.html')


from django.http import HttpResponse
from django.urls import reverse
from django.shortcuts import render


def dynamic_url_view(request):
    hello_django_url = reverse('myapp:hello_django')
    add_numbers_url = reverse('myapp:add_numbers', kwargs={'a': 3, 'b': 5})
    post_view_url = reverse('myapp:post_view', kwargs={'number': 123})

    return render(request, 'dynamic_urls.html', {
        'hello_django_url': hello_django_url,
        'add_numbers_url': add_numbers_url,
        'post_view_url': post_view_url,
    })
def redirect_view(request):
    return redirect('myapp:hello_django')